home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / autoba2a / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-24  |  55.9 KB  |  1,593 lines

  1. VERSION 5.00
  2. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  3. Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
  4. Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
  5. Begin VB.Form Form1 
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "Auto Backup"
  8.    ClientHeight    =   5400
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   5940
  12.    Icon            =   "Main.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   5400
  18.    ScaleWidth      =   5940
  19.    StartUpPosition =   2  'CenterScreen
  20.    Begin VB.Timer Timer1 
  21.       Interval        =   59000
  22.       Left            =   0
  23.       Top             =   4920
  24.    End
  25.    Begin VB.CommandButton Command3 
  26.       Cancel          =   -1  'True
  27.       Caption         =   "Minimize and save changes (ESC)"
  28.       Height          =   495
  29.       Left            =   960
  30.       TabIndex        =   0
  31.       Top             =   4800
  32.       Width           =   1695
  33.    End
  34.    Begin VB.CommandButton Command2 
  35.       Caption         =   "Quit"
  36.       Height          =   495
  37.       Left            =   3360
  38.       TabIndex        =   1
  39.       Top             =   4800
  40.       Width           =   1695
  41.    End
  42.    Begin TabDlg.SSTab SSTab1 
  43.       Height          =   4575
  44.       Left            =   120
  45.       TabIndex        =   2
  46.       Top             =   120
  47.       Width           =   5700
  48.       _ExtentX        =   10054
  49.       _ExtentY        =   8070
  50.       _Version        =   393216
  51.       Style           =   1
  52.       Tabs            =   5
  53.       TabsPerRow      =   5
  54.       TabHeight       =   520
  55.       ShowFocusRect   =   0   'False
  56.       TabCaption(0)   =   "Hour/Day"
  57.       TabPicture(0)   =   "Main.frx":0E42
  58.       Tab(0).ControlEnabled=   -1  'True
  59.       Tab(0).Control(0)=   "CheckBox4"
  60.       Tab(0).Control(0).Enabled=   0   'False
  61.       Tab(0).Control(1)=   "CheckBox1"
  62.       Tab(0).Control(1).Enabled=   0   'False
  63.       Tab(0).Control(2)=   "Label9"
  64.       Tab(0).Control(2).Enabled=   0   'False
  65.       Tab(0).Control(3)=   "Label4"
  66.       Tab(0).Control(3).Enabled=   0   'False
  67.       Tab(0).Control(4)=   "OptionButton2"
  68.       Tab(0).Control(4).Enabled=   0   'False
  69.       Tab(0).Control(5)=   "Label5"
  70.       Tab(0).Control(5).Enabled=   0   'False
  71.       Tab(0).Control(6)=   "Label6"
  72.       Tab(0).Control(6).Enabled=   0   'False
  73.       Tab(0).Control(7)=   "CheckBox2(1)"
  74.       Tab(0).Control(7).Enabled=   0   'False
  75.       Tab(0).Control(8)=   "CheckBox2(7)"
  76.       Tab(0).Control(8).Enabled=   0   'False
  77.       Tab(0).Control(9)=   "CheckBox2(6)"
  78.       Tab(0).Control(9).Enabled=   0   'False
  79.       Tab(0).Control(10)=   "CheckBox2(5)"
  80.       Tab(0).Control(10).Enabled=   0   'False
  81.       Tab(0).Control(11)=   "CheckBox2(4)"
  82.       Tab(0).Control(11).Enabled=   0   'False
  83.       Tab(0).Control(12)=   "CheckBox2(3)"
  84.       Tab(0).Control(12).Enabled=   0   'False
  85.       Tab(0).Control(13)=   "CheckBox2(2)"
  86.       Tab(0).Control(13).Enabled=   0   'False
  87.       Tab(0).Control(14)=   "OptionButton3"
  88.       Tab(0).Control(14).Enabled=   0   'False
  89.       Tab(0).Control(15)=   "Label8"
  90.       Tab(0).Control(15).Enabled=   0   'False
  91.       Tab(0).Control(16)=   "OptionButton1"
  92.       Tab(0).Control(16).Enabled=   0   'False
  93.       Tab(0).Control(17)=   "Label7"
  94.       Tab(0).Control(17).Enabled=   0   'False
  95.       Tab(0).Control(18)=   "Label3"
  96.       Tab(0).Control(18).Enabled=   0   'False
  97.       Tab(0).Control(19)=   "MaskEdBox2"
  98.       Tab(0).Control(19).Enabled=   0   'False
  99.       Tab(0).Control(20)=   "MaskEdBox1"
  100.       Tab(0).Control(20).Enabled=   0   'False
  101.       Tab(0).Control(21)=   "Command6"
  102.       Tab(0).Control(21).Enabled=   0   'False
  103.       Tab(0).ControlCount=   22
  104.       TabCaption(1)   =   "Files/Directories"
  105.       TabPicture(1)   =   "Main.frx":0E5E
  106.       Tab(1).ControlEnabled=   0   'False
  107.       Tab(1).Control(0)=   "File1"
  108.       Tab(1).Control(1)=   "Command4"
  109.       Tab(1).Control(2)=   "List1"
  110.       Tab(1).Control(3)=   "Command1"
  111.       Tab(1).Control(4)=   "Dir1"
  112.       Tab(1).Control(5)=   "Drive1"
  113.       Tab(1).Control(6)=   "Command5"
  114.       Tab(1).Control(7)=   "Label1"
  115.       Tab(1).Control(8)=   "CheckBox3"
  116.       Tab(1).ControlCount=   9
  117.       TabCaption(2)   =   "Destiny"
  118.       TabPicture(2)   =   "Main.frx":0E7A
  119.       Tab(2).ControlEnabled=   0   'False
  120.       Tab(2).Control(0)=   "Drive2"
  121.       Tab(2).Control(1)=   "Dir2"
  122.       Tab(2).Control(2)=   "Text1"
  123.       Tab(2).Control(3)=   "Label2"
  124.       Tab(2).ControlCount=   4
  125.       TabCaption(3)   =   "Progress"
  126.       TabPicture(3)   =   "Main.frx":0E96
  127.       Tab(3).ControlEnabled=   0   'False
  128.       Tab(3).Control(0)=   "Command7"
  129.       Tab(3).Control(1)=   "Label14"
  130.       Tab(3).Control(2)=   "Label13"
  131.       Tab(3).Control(3)=   "Label12"
  132.       Tab(3).Control(4)=   "Label11"
  133.       Tab(3).Control(5)=   "Label10"
  134.       Tab(3).ControlCount=   6
  135.       TabCaption(4)   =   "About"
  136.       TabPicture(4)   =   "Main.frx":0EB2
  137.       Tab(4).ControlEnabled=   0   'False
  138.       Tab(4).Control(0)=   "Label16"
  139.       Tab(4).Control(1)=   "Label15"
  140.       Tab(4).ControlCount=   2
  141.       Begin VB.CommandButton Command7 
  142.          Caption         =   "See log file..."
  143.          Height          =   495
  144.          Left            =   -73800
  145.          TabIndex        =   43
  146.          Top             =   3720
  147.          Width           =   3255
  148.       End
  149.       Begin VB.FileListBox File1 
  150.          Height          =   1650
  151.          Left            =   -72000
  152.          MultiSelect     =   2  'Extended
  153.          TabIndex        =   15
  154.          Top             =   2040
  155.          Width           =   2535
  156.       End
  157.       Begin VB.CommandButton Command4 
  158.          Caption         =   "+ Directory"
  159.          Height          =   375
  160.          Left            =   -73440
  161.          TabIndex        =   14
  162.          Top             =   3885
  163.          Width           =   1215
  164.       End
  165.       Begin VB.ListBox List1 
  166.          Height          =   1230
  167.          ItemData        =   "Main.frx":0ECE
  168.          Left            =   -74880
  169.          List            =   "Main.frx":0ED0
  170.          MultiSelect     =   2  'Extended
  171.          Sorted          =   -1  'True
  172.          TabIndex        =   13
  173.          Top             =   720
  174.          Width           =   5415
  175.       End
  176.       Begin VB.CommandButton Command1 
  177.          Caption         =   "Exclude"
  178.          Height          =   375
  179.          Left            =   -70800
  180.          TabIndex        =   12
  181.          Top             =   3885
  182.          Width           =   1215
  183.       End
  184.       Begin VB.DirListBox Dir1 
  185.          Height          =   1215
  186.          Left            =   -74880
  187.          TabIndex        =   11
  188.          Top             =   2460
  189.          Width           =   2775
  190.       End
  191.       Begin VB.DriveListBox Drive1 
  192.          Height          =   315
  193.          Left            =   -74880
  194.          TabIndex        =   10
  195.          Top             =   2040
  196.          Width           =   2775
  197.       End
  198.       Begin VB.CommandButton Command5 
  199.          Caption         =   "+ File(s)"
  200.          Height          =   375
  201.          Left            =   -72120
  202.          TabIndex        =   9
  203.          Top             =   3885
  204.          Width           =   1215
  205.       End
  206.       Begin VB.CommandButton Command6 
  207.          Caption         =   "Do backup now!"
  208.          Height          =   495
  209.          Left            =   3720
  210.          TabIndex        =   8
  211.          Top             =   3780
  212.          Width           =   1695
  213.       End
  214.       Begin VB.DriveListBox Drive2 
  215.          Height          =   315
  216.          Left            =   -73680
  217.          TabIndex        =   5
  218.          Top             =   1200
  219.          Width           =   2895
  220.       End
  221.       Begin VB.DirListBox Dir2 
  222.          Height          =   2565
  223.          Left            =   -73680
  224.          TabIndex        =   4
  225.          Top             =   1680
  226.          Width           =   2895
  227.       End
  228.       Begin VB.TextBox Text1 
  229.          Height          =   285
  230.          Left            =   -74640
  231.          Locked          =   -1  'True
  232.          TabIndex        =   3
  233.          Top             =   720
  234.          Width           =   4935
  235.       End
  236.       Begin MSMask.MaskEdBox MaskEdBox1 
  237.          Height          =   285
  238.          Left            =   1845
  239.          TabIndex        =   6
  240.          TabStop         =   0   'False
  241.          Top             =   930
  242.          Width           =   615
  243.          _ExtentX        =   1085
  244.          _ExtentY        =   503
  245.          _Version        =   393216
  246.          MaxLength       =   5
  247.          Mask            =   "##:##"
  248.          PromptChar      =   "_"
  249.       End
  250.       Begin MSMask.MaskEdBox MaskEdBox2 
  251.          Height          =   285
  252.          Left            =   1845
  253.          TabIndex        =   7
  254.          Top             =   1290
  255.          Width           =   615
  256.          _ExtentX        =   1085
  257.          _ExtentY        =   503
  258.          _Version        =   393216
  259.          MaxLength       =   5
  260.          Mask            =   "##:##"
  261.          PromptChar      =   "_"
  262.       End
  263.       Begin VB.Label Label16 
  264.          Alignment       =   2  'Center
  265.          AutoSize        =   -1  'True
  266.          Caption         =   "Please mail me your comments and suggestions!"
  267.          BeginProperty Font 
  268.             Name            =   "MS Sans Serif"
  269.             Size            =   8.25
  270.             Charset         =   0
  271.             Weight          =   700
  272.             Underline       =   -1  'True
  273.             Italic          =   0   'False
  274.             Strikethrough   =   0   'False
  275.          EndProperty
  276.          Height          =   195
  277.          Left            =   -74280
  278.          MouseIcon       =   "Main.frx":0ED2
  279.          MousePointer    =   99  'Custom
  280.          TabIndex        =   45
  281.          Top             =   2640
  282.          Width           =   4125
  283.       End
  284.       Begin VB.Label Label15 
  285.          AutoSize        =   -1  'True
  286.          Caption         =   "
  287. 1999 Alexandre Moro"
  288.          BeginProperty Font 
  289.             Name            =   "MS Sans Serif"
  290.             Size            =   9.75
  291.             Charset         =   0
  292.             Weight          =   400
  293.             Underline       =   0   'False
  294.             Italic          =   0   'False
  295.             Strikethrough   =   0   'False
  296.          EndProperty
  297.          Height          =   240
  298.          Left            =   -73200
  299.          TabIndex        =   44
  300.          Top             =   1800
  301.          Width           =   2010
  302.       End
  303.       Begin VB.Label Label14 
  304.          Alignment       =   2  'Center
  305.          Caption         =   " "
  306.          BeginProperty Font 
  307.             Name            =   "MS Sans Serif"
  308.             Size            =   9.75
  309.             Charset         =   0
  310.             Weight          =   400
  311.             Underline       =   0   'False
  312.             Italic          =   0   'False
  313.             Strikethrough   =   0   'False
  314.          EndProperty
  315.          Height          =   600
  316.          Left            =   -74880
  317.          TabIndex        =   42
  318.          Top             =   2880
  319.          Width           =   5400
  320.          WordWrap        =   -1  'True
  321.       End
  322.       Begin VB.Label Label13 
  323.          Alignment       =   2  'Center
  324.          Caption         =   " "
  325.          BeginProperty Font 
  326.             Name            =   "MS Sans Serif"
  327.             Size            =   9.75
  328.             Charset         =   0
  329.             Weight          =   400
  330.             Underline       =   0   'False
  331.             Italic          =   0   'False
  332.             Strikethrough   =   0   'False
  333.          EndProperty
  334.          Height          =   480
  335.          Left            =   -74880
  336.          TabIndex        =   41
  337.          Top             =   2280
  338.          Width           =   5400
  339.          WordWrap        =   -1  'True
  340.       End
  341.       Begin VB.Label Label12 
  342.          Alignment       =   2  'Center
  343.          Caption         =   " "
  344.          BeginProperty Font 
  345.             Name            =   "MS Sans Serif"
  346.             Size            =   9.75
  347.             Charset         =   0
  348.             Weight          =   400
  349.             Underline       =   0   'False
  350.             Italic          =   0   'False
  351.             Strikethrough   =   0   'False
  352.          EndProperty
  353.          Height          =   240
  354.          Left            =   -74880
  355.          TabIndex        =   40
  356.          Top             =   1800
  357.          Width           =   5400
  358.       End
  359.       Begin VB.Label Label11 
  360.          Alignment       =   2  'Center
  361.          Caption         =   " "
  362.          BeginProperty Font 
  363.             Name            =   "MS Sans Serif"
  364.             Size            =   9.75
  365.             Charset         =   0
  366.             Weight          =   400
  367.             Underline       =   0   'False
  368.             Italic          =   0   'False
  369.             Strikethrough   =   0   'False
  370.          EndProperty
  371.          Height          =   480
  372.          Left            =   -74880
  373.          TabIndex        =   39
  374.          Top             =   1200
  375.          Width           =   5400
  376.          WordWrap        =   -1  'True
  377.       End
  378.       Begin VB.Label Label10 
  379.          Alignment       =   2  'Center
  380.          Caption         =   " "
  381.          BeginProperty Font 
  382.             Name            =   "MS Sans Serif"
  383.             Size            =   9.75
  384.             Charset         =   0
  385.             Weight          =   400
  386.             Underline       =   0   'False
  387.             Italic          =   0   'False
  388.             Strikethrough   =   0   'False
  389.          EndProperty
  390.          Height          =   240
  391.          Left            =   -74880
  392.          TabIndex        =   38
  393.          Top             =   720
  394.          Width           =   5400
  395.       End
  396.       Begin VB.Label Label1 
  397.          AutoSize        =   -1  'True
  398.          Caption         =   "Files / Directories to be copied:"
  399.          Height          =   195
  400.          Left            =   -74880
  401.          TabIndex        =   37
  402.          Top             =   480
  403.          Width           =   2205
  404.       End
  405.       Begin VB.Label Label2 
  406.          AutoSize        =   -1  'True
  407.          Caption         =   "Destiny directory:"
  408.          Height          =   195
  409.          Left            =   -74640
  410.          TabIndex        =   36
  411.          Top             =   480
  412.          Width           =   1215
  413.       End
  414.       Begin VB.Label Label3 
  415.          AutoSize        =   -1  'True
  416.          Caption         =   "Backup when..."
  417.          Height          =   195
  418.          Left            =   240
  419.          TabIndex        =   35
  420.          Top             =   480
  421.          Width           =   1125
  422.       End
  423.       Begin VB.Label Label7 
  424.          AutoSize        =   -1  'True
  425.          Caption         =   "hours:minutes"
  426.          Height          =   195
  427.          Left            =   2640
  428.          TabIndex        =   34
  429.          Top             =   1335
  430.          Width           =   975
  431.       End
  432.       Begin MSForms.OptionButton OptionButton1 
  433.          Height          =   345
  434.          Left            =   1560
  435.          TabIndex        =   33
  436.          Top             =   900
  437.          Width           =   405
  438.          VariousPropertyBits=   1015023643
  439.          BackColor       =   -2147483633
  440.          ForeColor       =   -2147483630
  441.          DisplayStyle    =   5
  442.          Size            =   "714;609"
  443.          Value           =   "1"
  444.          GroupName       =   "a"
  445.          FontHeight      =   165
  446.          FontCharSet     =   0
  447.          FontPitchAndFamily=   2
  448.       End
  449.       Begin VB.Label Label8 
  450.          AutoSize        =   -1  'True
  451.          Caption         =   "hours:minutes"
  452.          Height          =   195
  453.          Left            =   2640
  454.          TabIndex        =   32
  455.          Top             =   975
  456.          Width           =   975
  457.       End
  458.       Begin MSForms.OptionButton OptionButton3 
  459.          Height          =   345
  460.          Left            =   1560
  461.          TabIndex        =   31
  462.          Top             =   2100
  463.          Width           =   750
  464.          VariousPropertyBits=   1015023643
  465.          BackColor       =   -2147483633
  466.          ForeColor       =   -2147483630
  467.          DisplayStyle    =   5
  468.          Size            =   "1323;609"
  469.          Value           =   "1"
  470.          Caption         =   "Daily"
  471.          FontHeight      =   165
  472.          FontCharSet     =   0
  473.          FontPitchAndFamily=   2
  474.       End
  475.       Begin MSForms.CheckBox CheckBox2 
  476.          Height          =   345
  477.          Index           =   2
  478.          Left            =   1560
  479.          TabIndex        =   30
  480.          Top             =   2460
  481.          Width           =   975
  482.          VariousPropertyBits=   1015023643
  483.          BackColor       =   -2147483633
  484.          ForeColor       =   -2147483630
  485.          DisplayStyle    =   4
  486.          Size            =   "1720;609"
  487.          Value           =   "0"
  488.          Caption         =   "Monday"
  489.          FontHeight      =   165
  490.          FontCharSet     =   0
  491.          FontPitchAndFamily=   2
  492.       End
  493.       Begin MSForms.CheckBox CheckBox2 
  494.          Height          =   345
  495.          Index           =   3
  496.          Left            =   2880
  497.          TabIndex        =   29
  498.          Top             =   2460
  499.          Width           =   1020
  500.          VariousPropertyBits=   1015023643
  501.          BackColor       =   -2147483633
  502.          ForeColor       =   -2147483630
  503.          DisplayStyle    =   4
  504.          Size            =   "1799;609"
  505.          Value           =   "0"
  506.          Caption         =   "Tuesday"
  507.          FontHeight      =   165
  508.          FontCharSet     =   0
  509.          FontPitchAndFamily=   2
  510.       End
  511.       Begin MSForms.CheckBox CheckBox2 
  512.          Height          =   345
  513.          Index           =   4
  514.          Left            =   4080
  515.          TabIndex        =   28
  516.          Top             =   2460
  517.          Width           =   1260
  518.          VariousPropertyBits=   1015023643
  519.          BackColor       =   -2147483633
  520.          ForeColor       =   -2147483630
  521.          DisplayStyle    =   4
  522.          Size            =   "2222;609"
  523.          Value           =   "0"
  524.          Caption         =   "Wednesday"
  525.          FontHeight      =   165
  526.          FontCharSet     =   0
  527.          FontPitchAndFamily=   2
  528.       End
  529.       Begin MSForms.CheckBox CheckBox2 
  530.          Height          =   345
  531.          Index           =   5
  532.          Left            =   1560
  533.          TabIndex        =   27
  534.          Top             =   2820
  535.          Width           =   1065
  536.          VariousPropertyBits=   1015023643
  537.          BackColor       =   -2147483633
  538.          ForeColor       =   -2147483630
  539.          DisplayStyle    =   4
  540.          Size            =   "1879;609"
  541.          Value           =   "0"
  542.          Caption         =   "Thursday"
  543.          FontHeight      =   165
  544.          FontCharSet     =   0
  545.          FontPitchAndFamily=   2
  546.       End
  547.       Begin MSForms.CheckBox CheckBox2 
  548.          Height          =   345
  549.          Index           =   6
  550.          Left            =   2880
  551.          TabIndex        =   26
  552.          Top             =   2820
  553.          Width           =   825
  554.          VariousPropertyBits=   1015023643
  555.          BackColor       =   -2147483633
  556.          ForeColor       =   -2147483630
  557.          DisplayStyle    =   4
  558.          Size            =   "1455;609"
  559.          Value           =   "0"
  560.          Caption         =   "Friday"
  561.          FontHeight      =   165
  562.          FontCharSet     =   0
  563.          FontPitchAndFamily=   2
  564.       End
  565.       Begin MSForms.CheckBox CheckBox2 
  566.          Height          =   345
  567.          Index           =   7
  568.          Left            =   4080
  569.          TabIndex        =   25
  570.          Top             =   2820
  571.          Width           =   1035
  572.          VariousPropertyBits=   1015023643
  573.          BackColor       =   -2147483633
  574.          ForeColor       =   -2147483630
  575.          DisplayStyle    =   4
  576.          Size            =   "1826;609"
  577.          Value           =   "0"
  578.          Caption         =   "Saturday"
  579.          FontHeight      =   165
  580.          FontCharSet     =   0
  581.          FontPitchAndFamily=   2
  582.       End
  583.       Begin MSForms.CheckBox CheckBox2 
  584.          Height          =   345
  585.          Index           =   1
  586.          Left            =   1560
  587.          TabIndex        =   24
  588.          Top             =   3180
  589.          Width           =   945
  590.          VariousPropertyBits=   1015023643
  591.          BackColor       =   -2147483633
  592.          ForeColor       =   -2147483630
  593.          DisplayStyle    =   4
  594.          Size            =   "1667;609"
  595.          Value           =   "0"
  596.          Caption         =   "Sunday"
  597.          FontHeight      =   165
  598.          FontCharSet     =   0
  599.          FontPitchAndFamily=   2
  600.       End
  601.       Begin VB.Label Label6 
  602.          AutoSize        =   -1  'True
  603.          Caption         =   "When:"
  604.          Height          =   195
  605.          Left            =   960
  606.          TabIndex        =   23
  607.          Top             =   2175
  608.          Width           =   480
  609.       End
  610.       Begin VB.Label Label5 
  611.          AutoSize        =   -1  'True
  612.          Caption         =   "Always at:"
  613.          Height          =   195
  614.          Left            =   720
  615.          TabIndex        =   22
  616.          Top             =   975
  617.          Width           =   720
  618.       End
  619.       Begin MSForms.OptionButton OptionButton2 
  620.          Height          =   345
  621.          Left            =   1560
  622.          TabIndex        =   21
  623.          Top             =   1260
  624.          Width           =   405
  625.          VariousPropertyBits=   1015023643
  626.          BackColor       =   -2147483633
  627.          ForeColor       =   -2147483630
  628.          DisplayStyle    =   5
  629.          Size            =   "714;609"
  630.          Value           =   "0"
  631.          GroupName       =   "a"
  632.          FontHeight      =   165
  633.          FontCharSet     =   0
  634.          FontPitchAndFamily=   2
  635.       End
  636.       Begin VB.Label Label4 
  637.          AutoSize        =   -1  'True
  638.          Caption         =   "Or each:"
  639.          Height          =   195
  640.          Left            =   825
  641.          TabIndex        =   20
  642.          Top             =   1335
  643.          Width           =   615
  644.       End
  645.       Begin VB.Label Label9 
  646.          Alignment       =   2  'Center
  647.          AutoSize        =   -1  'True
  648.          Caption         =   "(interval initiated from now, or when the application starts)"
  649.          Height          =   390
  650.          Left            =   1560
  651.          TabIndex        =   19
  652.          Top             =   1620
  653.          Width           =   2580
  654.          WordWrap        =   -1  'True
  655.       End
  656.       Begin MSForms.CheckBox CheckBox1 
  657.          Height          =   345
  658.          Left            =   360
  659.          TabIndex        =   18
  660.          Top             =   3540
  661.          Width           =   1275
  662.          VariousPropertyBits=   1015023643
  663.          BackColor       =   -2147483633
  664.          ForeColor       =   -2147483630
  665.          DisplayStyle    =   4
  666.          Size            =   "2249;609"
  667.          Value           =   "1"
  668.          Caption         =   "Save log file"
  669.          FontHeight      =   165
  670.          FontCharSet     =   0
  671.          FontPitchAndFamily=   2
  672.       End
  673.       Begin MSForms.CheckBox CheckBox3 
  674.          Height          =   495
  675.          Left            =   -74760
  676.          TabIndex        =   17
  677.          Top             =   3825
  678.          Width           =   1215
  679.          BackColor       =   -2147483633
  680.          ForeColor       =   -2147483630
  681.          DisplayStyle    =   4
  682.          Size            =   "2143;873"
  683.          Value           =   "1"
  684.          Caption         =   "Include Subdirs"
  685.          FontHeight      =   165
  686.          FontCharSet     =   0
  687.          FontPitchAndFamily=   2
  688.       End
  689.       Begin MSForms.CheckBox CheckBox4 
  690.          Height          =   375
  691.          Left            =   360
  692.          TabIndex        =   16
  693.          Top             =   3960
  694.          Width           =   2055
  695.          BackColor       =   -2147483633
  696.          ForeColor       =   -2147483630
  697.          DisplayStyle    =   4
  698.          Size            =   "3625;661"
  699.          Value           =   "0"
  700.          Caption         =   "Incremental backup"
  701.          FontHeight      =   165
  702.          FontCharSet     =   0
  703.          FontPitchAndFamily=   2
  704.       End
  705.    End
  706.    Begin VB.Menu mnu_1 
  707.       Caption         =   "mnu_1"
  708.       Visible         =   0   'False
  709.       Begin VB.Menu MnuRestore 
  710.          Caption         =   "Restore"
  711.       End
  712.       Begin VB.Menu MnuBackup 
  713.          Caption         =   "Backup now!"
  714.       End
  715.       Begin VB.Menu MnuQuit 
  716.          Caption         =   "Quit"
  717.       End
  718.    End
  719. Attribute VB_Name = "Form1"
  720. Attribute VB_GlobalNameSpace = False
  721. Attribute VB_Creatable = False
  722. Attribute VB_PredeclaredId = True
  723. Attribute VB_Exposed = False
  724. Option Explicit
  725. '********** Auto Backup ***********
  726. '******* 
  727. 1999 Alexandre Moro *******
  728. 'You can freely distribute this source code,
  729. '   but if you do any modification please
  730. '                 let me know!
  731. '       Comments and suggestions:
  732. '         alb@cwb.matrix.com.br
  733. Dim NLoops As Integer, LoopDup As Integer, ListWithFocus As Boolean, Days As Byte
  734. Dim sRet As String, Ret As Long, MskErr1 As Boolean, MskErr2 As Boolean
  735. Dim DestinyDir As String, NoIniArchive As Boolean
  736. Dim WindowsDir As String, NLoopsTimer As Byte, Interval As Date, IniTime As Date
  737. Dim Default As Boolean, LastBackup As Date, Result As Long, Msg As Long, OpenError As Boolean
  738. Dim XDir(2) As New Collection, FromPath As String
  739. Private Const Arq = "Autobak.ini"
  740. Private Const SW_SHOW = 5
  741. Private Declare Function WritePrivateProfileString& Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As String, ByVal lpFileName As String)
  742. Private Declare Function GetPrivateProfileString& Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String)
  743. Private Declare Function GetWindowsDirectory& Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long)
  744. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  745. Private Type NOTIFYICONDATA
  746.     cbSize As Long
  747.     hwnd As Long
  748.     uId As Long
  749.     uFlags As Long
  750.     uCallBackMessage As Long
  751.     hIcon As Long
  752.     szTip As String * 64
  753. End Type
  754. Private Const NIM_ADD = &H0
  755. Private Const NIM_MODIFY = &H1
  756. Private Const NIM_DELETE = &H2
  757. Private Const NIF_MESSAGE = &H1
  758. Private Const NIF_ICON = &H2
  759. Private Const NIF_TIP = &H4
  760. Private Const WM_MOUSEMOVE = &H200
  761. Private Const WM_LBUTTONDOWN = &H201
  762. Private Const WM_LBUTTONUP = &H202
  763. Private Const WM_LBUTTONDBLCLK = &H203
  764. Private Const WM_RBUTTONDOWN = &H204
  765. Private Const WM_RBUTTONUP = &H205
  766. Private Const WM_RBUTTONDBLCLK = &H206
  767. Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
  768. Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
  769. Private nid As NOTIFYICONDATA
  770. Private Type ListaArqs
  771.     Nome As String
  772.     Tamanho As Long
  773. End Type
  774. Private Files() As ListaArqs
  775. Private Sub GetDirs(Path As String)
  776.     'on error Resume Next
  777.     Dim vDirName As String, LastDir As String
  778.     Dim i As Integer
  779.     'Adjust so No Deletion of Drive
  780.     If Len(Path$) < 4 Then Exit Sub
  781.     If Right(Path$, 1) <> "\" Then
  782.         XDir(0).Add Path$
  783.         Path$ = Path$ & "\"
  784.     End If
  785.     vDirName = Dir(Path, vbDirectory) ' Retrieve the first entry.
  786.     Do While vDirName <> ""
  787.         If vDirName <> "." And vDirName <> ".." Then
  788.             If (GetAttr(Path & vDirName)) = vbDirectory Then
  789.                 LastDir = vDirName
  790.                 'Finds Directory Name then Repeats
  791.                 GetDirs (Path$ & vDirName)
  792.                 vDirName = Dir(Path$, vbDirectory)
  793.                 Do Until vDirName = LastDir Or vDirName = ""
  794.                     vDirName = Dir
  795.                 Loop
  796.                 If vDirName = "" Then Exit Do
  797.             End If
  798.         End If
  799.     vDirName = Dir
  800.     Loop
  801. End Sub
  802. Private Function ExtractText(FullText As String, token As String, Optional StartAtLeft = True, Optional IncludeLeftSide = True) As String
  803. 'ExtractText(Path$, ":", False, False)
  804.     Dim i As Integer
  805.     If StartAtLeft = True And IncludeLeftSide = True Then
  806.         ExtractText = FullText
  807.         For i = 1 To Len(FullText)
  808.             If Mid(FullText, i, 1) = token Then
  809.                 ExtractText = Left(FullText, i - 1)
  810.                 Exit Function
  811.             End If
  812.         Next
  813.     ElseIf StartAtLeft = True And IncludeLeftSide = False Then
  814.         ExtractText = FullText
  815.         For i = 1 To Len(FullText)
  816.             If Mid(FullText, i, 1) = token Then
  817.                 ExtractText = Right(FullText, Len(FullText) - i)
  818.                 Exit Function
  819.             End If
  820.         Next
  821.     ElseIf StartAtLeft = False And IncludeLeftSide = True Then
  822.         ExtractText = ""
  823.         For i = Len(FullText) To 1 Step -1
  824.             If Mid(FullText, i, 1) = token Then
  825.                 ExtractText = Left(FullText, i - 1)
  826.                 Exit Function
  827.             End If
  828.         Next
  829.     ElseIf StartAtLeft = False And IncludeLeftSide = False Then
  830.         ExtractText = ""
  831.         For i = Len(FullText) To 1 Step -1
  832.             If Mid(FullText, i, 1) = token Then
  833.                 ExtractText = Right(FullText, Len(FullText) - i)
  834.                 Exit Function
  835.             End If
  836.         Next
  837.     End If
  838. End Function
  839. Private Sub MtxAdicionaArq(CamCompleto As String)
  840.     If UBound(Files) = 1 Then
  841.         Files(1).Nome = CamCompleto
  842.         Files(1).Tamanho = FileLen(CamCompleto)
  843.         ReDim Preserve Files(2)
  844.     Else
  845.         Files(UBound(Files)).Nome = CamCompleto
  846.         Files(UBound(Files)).Tamanho = FileLen(CamCompleto)
  847.         ReDim Preserve Files(UBound(Files) + 1)
  848.     End If
  849. End Sub
  850. Private Sub MtxAdicionaDir(ByVal Caminho As String)
  851. On Error GoTo erro
  852.     Dim B As String, n As Integer, ShortPath As String
  853.     If Not Right(Caminho, 1) = "*" Then Caminho = Caminho & "*.*"
  854.     ShortPath = Left(Caminho, Len(Caminho) - 3)
  855.             
  856.     If Not UBound(Files) = 1 Then
  857.         n = UBound(Files) + 1
  858.         ReDim Preserve Files(n)
  859.     End If
  860.     B = Dir(Caminho)
  861.     If B = "" Then
  862.         Exit Sub
  863.     Else
  864.         Files(UBound(Files) - 1).Nome = ShortPath & B
  865.         Files(UBound(Files) - 1).Tamanho = FileLen(ShortPath & B)
  866.     End If
  867.     Do
  868.     B = Dir
  869.     If B = "" Then Exit Do
  870.         
  871.     With Files(n)
  872.         .Nome = ShortPath & B
  873.         .Tamanho = FileLen(ShortPath & B)
  874.     End With
  875.     n = n + 1
  876.     ReDim Preserve Files(n)
  877.     Loop
  878.     Exit Sub
  879. erro:
  880.     MsgBox "MtxAddDir:" & vbLf & vbLf & Err.Number & ":" & Err.Description, vbCritical
  881.     Resume Sa
  882. End Sub
  883. Private Sub AddItem(OnlyFile As Boolean, Optional WithSubs As Boolean = False)
  884. On Error GoTo erro
  885.     Screen.MousePointer = vbHourglass
  886.     Dim AddPath As String
  887.     If Right(Dir1.Path, 1) = "\" Then
  888.         AddPath = Dir1.Path
  889.     Else
  890.         AddPath = Dir1.Path & "\"
  891.     End If
  892.     If Not OnlyFile Then
  893.         
  894.         If WithSubs Then
  895.             Dim i As Integer, d As String
  896.             GetDirs (AddPath)
  897.             For i = 1 To XDir(0).Count
  898.                 If VerificaDup(XDir(0).Item(i) & "\*.*") Then
  899.                     MsgBox "This item is already on the list:" & vbLf & vbLf & XDir(0).Item(i) & "\*.*", vbExclamation
  900.                 Else
  901.                     List1.AddItem XDir(0).Item(i) & "\*.*"
  902.                 End If
  903.             Next i
  904.             For i = XDir(0).Count To 1 Step -1
  905.                 XDir(0).Remove (i)
  906.             Next i
  907.         End If
  908.         
  909.         If List1.ListCount = 0 Then
  910.             List1.AddItem AddPath & "*.*"
  911.             GoTo Sa
  912.         Else
  913.             If VerificaDup(AddPath & "*.*") Then
  914.                 MsgBox "This item is already on the list:" & vbLf & vbLf & AddPath & "*.*", vbExclamation
  915.                 GoTo Sa
  916.             Else
  917.                 List1.AddItem AddPath & "*.*"
  918.                 GoTo Sa
  919.             End If
  920.         End If
  921.         
  922.     Else
  923.         Dim Entries As Integer
  924.         For NLoops = 0 To File1.ListCount - 1
  925.             If File1.Selected(NLoops) Then
  926.                 Entries = Entries + 1
  927.                 If Entries > 1 Then GoTo cont
  928.             End If
  929.         Next NLoops
  930. cont:
  931.         If Entries = 1 Then
  932.             If VerificaDup(AddPath & File1.FileName) Then
  933.                 MsgBox "This item is already on the list:" & vbLf & vbLf & AddPath & File1.FileName, vbExclamation
  934.                 GoTo Sa
  935.             Else
  936.                 List1.AddItem AddPath & File1.FileName
  937.                 GoTo Sa
  938.             End If
  939.         ElseIf Entries > 1 Then
  940.             For NLoops = 0 To File1.ListCount - 1
  941.                 If File1.Selected(NLoops) Then
  942.                     If VerificaDup(AddPath & File1.List(NLoops)) Then
  943.                         MsgBox "This item is already on the list:" & vbLf & vbLf & AddPath & File1.List(NLoops), vbExclamation
  944.                     Else
  945.                         List1.AddItem AddPath & File1.List(NLoops)
  946.                     End If
  947.                 End If
  948.             Next NLoops
  949.         End If
  950.         
  951.     End If
  952.     Screen.MousePointer = vbDefault
  953.     Exit Sub
  954. erro:
  955.     MsgBox Err.Number & vbLf & Err.Description, vbCritical
  956.     Resume Sa
  957.                     
  958. End Sub
  959. Private Sub Backup()
  960. On Error GoTo erro
  961.     Screen.MousePointer = vbHourglass
  962.     Dim DateBak As Date, TimeBak As Date, ErrString As String
  963.     Dim NDirs As Integer, File As String, TskID As Double, TotFiles As Long, TotalFilesCopied As Long
  964.     Dim ErroDest As Byte, ArqAtr As Byte, Tam As Long
  965.         
  966.     SSTab1.Tab = 3
  967.     TimeBak = Now
  968.     DateBak = Date
  969.     Me.Caption = "Creating file list..."
  970.     If Not Right(DestinyDir, 1) = "\" Then DestinyDir = DestinyDir & "\"
  971.     For NLoops = 0 To List1.ListCount - 1
  972.         If Right(List1.List(NLoops), 1) = "*" Then
  973.             MtxAdicionaDir (Left(List1.List(NLoops), Len(List1.List(NLoops)) - 3))
  974.         Else
  975.             MtxAdicionaArq (List1.List(NLoops))
  976.         End If
  977.     Next NLoops
  978.     Me.Caption = "Doing the backup..."
  979.     If CheckBox1 Then
  980.         Open WindowsDir & "Log Autobak.txt" For Output As #1
  981.         Print #1, "Initializing backup at " & Now
  982.         Print #1,
  983.     End If
  984.     Label10.Caption = "Copying now"
  985.     Label12.Caption = "to"
  986.     TotFiles = UBound(Files) - 1
  987.     For NLoops = 0 To TotFiles
  988.         DoEvents
  989.         If Not Files(NLoops).Nome = "" Then
  990.             ArqAtr = GetAttr(Files(NLoops).Nome)
  991.             Label11.Caption = Files(NLoops).Nome
  992.             Label13.Caption = DestinyDir & ReturnFileName(Files(NLoops).Nome)
  993.             Label14.Caption = "File " & NLoops & " of " & TotFiles
  994. cont:
  995.             If CheckBox4 Then
  996.                 If ArqAtr And vbArchive <> 0 Then
  997.                     If CheckBox1 Then Print #1, Files(NLoops).Nome & " --> " & DestinyDir & ReturnFileName(Files(NLoops).Nome) & ", status: ";
  998.                     FileCopy Files(NLoops).Nome, DestinyDir & ReturnFileName(Files(NLoops).Nome)
  999.                     SetAttr Files(NLoops).Nome, (ArqAtr - vbArchive)
  1000.                     If CheckBox1 Then Print #1, "Ok!"
  1001.                     Tam = Tam + FileLen(Files(NLoops).Nome)
  1002.                     TotalFilesCopied = TotalFilesCopied + 1
  1003.                 End If
  1004.             Else
  1005.                 If CheckBox1 Then Print #1, Files(NLoops).Nome & " --> " & DestinyDir & ReturnFileName(Files(NLoops).Nome) & ", status: ";
  1006.                 FileCopy Files(NLoops).Nome, DestinyDir & ReturnFileName(Files(NLoops).Nome)
  1007.                 If CheckBox1 Then Print #1, "Ok!"
  1008.                 Tam = Tam + FileLen(Files(NLoops).Nome)
  1009.                 TotalFilesCopied = TotalFilesCopied + 1
  1010.             End If
  1011.             Label14.Caption = "File " & NLoops & " of " & TotFiles & ", total: " & _
  1012.                         Format(Tam / 1024 / 1024, "standard") & " Mb"
  1013.         End If
  1014.     Next NLoops
  1015.     If CheckBox1 Then
  1016.         Print #1,
  1017.         Print #1, "Copied " & TotalFilesCopied & " files, " & Format(Tam / 1024 / 1024, "standard") & " Mb, from " & _
  1018.             Format(TimeBak, "short time") & " to " & Format(Time, "short time") & " of " & _
  1019.             Format(DateBak, "short date") & "."
  1020.         Close #1
  1021.     End If
  1022.     Label10.Caption = ""
  1023.     Label11.Caption = ""
  1024.     Label12.Caption = ""
  1025.     Label13.Caption = ""
  1026.     Label14.Caption = "Copied " & TotalFilesCopied & " files, " & Format(Tam / 1024 / 1024, "standard") & " Mb, from " & _
  1027.         Format(TimeBak, "short time") & " to " & Format(Time, "short time") & " of " & _
  1028.         Format(DateBak, "short date") & "."
  1029.     ReDim Files(0)
  1030.     Me.Caption = "Auto Backup"
  1031.     Screen.MousePointer = vbDefault
  1032.     Exit Sub
  1033. erro:
  1034.     ErrString = vbLf & vbLf & "While trying to copy:" & vbLf & Files(NLoops).Nome & _
  1035.         vbLf & "to" & vbLf & DestinyDir & ReturnFileName(Files(NLoops).Nome) & vbLf & _
  1036.         vbLf & "Try again?"
  1037.     If CheckBox1 Then Print #1, "ERROR: " & Err.Number & " - " & Err.Description;
  1038.     Select Case Err.Number
  1039.         
  1040.         Case 5      'Invalid procedure call ???
  1041.             Resume Next
  1042.                     
  1043.         Case 52    'Bad filename
  1044.             MsgBox "Bad filename! (erro 52)" & vbLf & vbLf & Files(NLoops).Nome, vbExclamation
  1045.             Resume Next
  1046.             
  1047.         Case 53     'File not found
  1048.             MsgBox "File not found! (erro 53)" & vbLf & vbLf & Files(NLoops).Nome, vbExclamation
  1049.             Resume Next
  1050.                     
  1051.         Case 57     'Device I/O error
  1052.             If MsgBox("Destiny disk not ready! (erro 57)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1053.             
  1054.         Case 61     'Disk full
  1055.             If MsgBox("Destiny disk full! (error 61)" & ErrString, vbExclamation + vbYesNo) = vbYes Then Resume cont
  1056.                     
  1057.         Case 70    'Permission denied
  1058.             If MsgBox("Destiny directory or drive protected! (error 70)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1059.             
  1060.         Case 71    'Disk not ready
  1061.             If MsgBox("Destiny disk not ready! (error 71)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1062.                 
  1063.         Case 75     'Path/file access error
  1064.             SetAttr DestinyDir & ReturnFileName(Files(NLoops).Nome), (GetAttr(DestinyDir & ReturnFileName(Files(NLoops).Nome)) - vbReadOnly)
  1065.             Resume cont
  1066.         
  1067.         Case 76     'Path not found
  1068.             If MsgBox("Destiny directory unavailable! (error 76)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1069.         
  1070.         Case Else
  1071.             If MsgBox("PANIC!!" & vbLf & vbLf & Err.Number & ": " & Err.Description & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1072.     End Select
  1073.     Resume Sa
  1074. End Sub
  1075. Private Function ReturnFileName(ByVal Arq As String) As String
  1076. 'Arq is the full path, returns only the filename
  1077.     Dim n As Integer
  1078.     For n = Len(Arq) To 1 Step -1
  1079.         If Mid(Arq, n, 1) = "\" Then
  1080.             ReturnFileName = Right(Arq, Len(Arq) - n)
  1081.             Exit Function
  1082.         End If
  1083.     Next n
  1084. End Function
  1085. Private Sub CheckTime()
  1086. On Error GoTo erro
  1087.     If OptionButton1 And Not IniTime = vbEmpty Then
  1088.         If IniTime = TimeSerial(Hour(Time), Minute(Time), 0) Then
  1089.             Me.Caption = "Doing the Backup..."
  1090.             Me.Refresh
  1091.             Backup
  1092.             LastBackup = TimeSerial(Hour(Time), Minute(Time), 0)
  1093.             Me.Caption = "Auto Backup"
  1094.             Me.Refresh
  1095.         End If
  1096.     End If
  1097.     If OptionButton2 And Not Interval = vbEmpty Then
  1098.         If TimeSerial(Hour(Time), Minute(Time), 0) = TimeValue(Interval + LastBackup) Then
  1099.             Me.Caption = "Doing the Backup..."
  1100.             Me.Refresh
  1101.             Backup
  1102.             LastBackup = TimeSerial(Hour(Time), Minute(Time), 0)
  1103.             Me.Caption = "Auto Backup"
  1104.             Me.Refresh
  1105.         End If
  1106.     End If
  1107.     Exit Sub
  1108. erro:
  1109.     If Not Err.Number = 13 Then MsgBox Err.Number & vbLf & Err.Description
  1110.     Resume Sa
  1111. End Sub
  1112. Private Sub Initialize()
  1113. On Error GoTo erro
  1114.     Dim Lenght As Byte
  1115.     WindowsDir = String(255, 0)
  1116.     Lenght = GetWindowsDirectory(WindowsDir, 254)
  1117.     WindowsDir = Left(WindowsDir, Lenght)
  1118.     If Not Right(WindowsDir, 1) = "\" Then WindowsDir = WindowsDir & "\"
  1119.     If Dir(WindowsDir & "Autobak.ini") = "" Then
  1120.         If Dir(WindowsDir & "Autobak.bak") <> "" Then
  1121.             FileCopy WindowsDir & "Autobak.bak", WindowsDir & "Autobak.ini"
  1122.         Else
  1123.             NoIniArchive = True
  1124.         End If
  1125.     End If
  1126.         
  1127.     sRet = String(255, 0)
  1128.     Ret = GetPrivateProfileString("When", "AlwaysAt", "", sRet, 255, Arq)
  1129.     sRet = Left(sRet, Ret)
  1130.     If Not Ret = 0 Then
  1131.         If sRet = "???" Then
  1132.             IniTime = vbEmpty
  1133.         Else
  1134.             MaskEdBox1.Text = sRet
  1135.             IniTime = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0)
  1136.         End If
  1137.     End If
  1138.     sRet = String(255, 0)
  1139.     Ret = GetPrivateProfileString("When", "Each", "", sRet, 255, Arq)
  1140.     sRet = Left(sRet, Ret)
  1141.     If Not Ret = 0 Then
  1142.         If sRet = "???" Then
  1143.             Interval = vbEmpty
  1144.         Else
  1145.             MaskEdBox2.Text = sRet
  1146.             Interval = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0)
  1147.         End If
  1148.     End If
  1149.     sRet = String(255, 0)
  1150.     Ret = GetPrivateProfileString("When", "Default", "", sRet, 255, Arq)
  1151.     sRet = Left(sRet, Ret)
  1152.     If Not Ret = 0 Then
  1153.         If sRet = "False" Then
  1154.             Default = False
  1155.         Else
  1156.             Default = True
  1157.         End If
  1158.     End If
  1159.     sRet = String(255, 0)
  1160.     Ret = GetPrivateProfileString("When", "Days", "", sRet, 255, Arq)
  1161.     sRet = Left(sRet, Ret)
  1162.     If Not Ret = 0 Then
  1163.         Dim BsRet As Byte
  1164.         BsRet = CByte(sRet)
  1165.         If Int(BsRet / 64) = 1 Then CheckBox2(7).Value = True: BsRet = BsRet - 64
  1166.         If Int(BsRet / 32) = 1 Then CheckBox2(6).Value = True: BsRet = BsRet - 32
  1167.         If Int(BsRet / 16) = 1 Then CheckBox2(5).Value = True: BsRet = BsRet - 16
  1168.         If Int(BsRet / 8) = 1 Then CheckBox2(4).Value = True: BsRet = BsRet - 8
  1169.         If Int(BsRet / 4) = 1 Then CheckBox2(3).Value = True: BsRet = BsRet - 4
  1170.         If Int(BsRet / 2) = 1 Then CheckBox2(2).Value = True: BsRet = BsRet - 2
  1171.         If Int(BsRet / 1) = 1 Then CheckBox2(1).Value = True
  1172.     End If
  1173.     sRet = String(255, 0)
  1174.     Ret = GetPrivateProfileString("Log", "Save", "", sRet, 255, Arq)
  1175.     sRet = Left(sRet, Ret)
  1176.     If Not Ret = 0 Then If sRet = "False" Then CheckBox1.Value = False
  1177.     sRet = String(255, 0)
  1178.     Ret = GetPrivateProfileString("Backup", "Incremental", "", sRet, 255, Arq)
  1179.     sRet = Left(sRet, Ret)
  1180.     If Not Ret = 0 Then If sRet = "True" Then CheckBox4.Value = True
  1181.     sRet = String(255, 0)
  1182.     Ret = GetPrivateProfileString("Destiny", "Dir", "", sRet, 255, Arq)
  1183.     sRet = Left(sRet, Ret)
  1184.     If Not Ret = 0 Then
  1185.         On Error GoTo erro1
  1186.         Dir2.Path = sRet
  1187.         Drive2.Drive = Left(sRet, 2)
  1188.         On Error GoTo erro
  1189.     End If
  1190. cont:
  1191.     DestinyDir = sRet
  1192.     Text1.Text = DestinyDir
  1193.     NLoops = 0
  1194.     ReDim Files(0)
  1195. start:
  1196.     sRet = String(255, 0)
  1197.     Ret = GetPrivateProfileString("Entries", NLoops, "", sRet, 255, Arq)
  1198.     If Ret = 0 Then LastBackup = TimeSerial(Hour(Time), Minute(Time), 0): Exit Sub
  1199.     sRet = Left(sRet, Ret)
  1200.     List1.AddItem sRet
  1201.     NLoops = NLoops + 1
  1202.     GoTo start
  1203.     Exit Sub
  1204. erro:
  1205.     MsgBox Err.Number & vbLf & vbLf & Err.Description, vbCritical, "Initializing!"
  1206.     Resume Next
  1207. erro1:
  1208.     If Err.Number = 68 Or Err.Number = 76 Then
  1209.         'MsgBox "O diret
  1210. rio ou drive de destino n
  1211. o est
  1212.  dispon
  1213. vel!" & vbLf & vbLf & _
  1214.             "Deixado como Default ""C:\""", vbExclamation
  1215.         'sRet = "C:\"
  1216.     Else
  1217.         MsgBox Err.Number & vbLf & Err.Description
  1218.     End If
  1219.     Resume cont
  1220. End Sub
  1221. Private Sub SaveChanges()
  1222. On Error GoTo erro
  1223.     Screen.MousePointer = vbHourglass
  1224.         
  1225.     On Error Resume Next
  1226.     Name WindowsDir & Arq As WindowsDir & "Autobak.bak"
  1227.     Kill WindowsDir & Arq
  1228.     On Error GoTo erro
  1229.     If Not MaskEdBox1.Text = "__:__" Then
  1230.         Call WritePrivateProfileString("When", "AlwaysAt", MaskEdBox1.Text, Arq)
  1231.         IniTime = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0)
  1232.     Else
  1233.         Call WritePrivateProfileString("When", "AlwaysAt", "???", Arq)
  1234.         IniTime = vbEmpty
  1235.     End If
  1236.     If Not MaskEdBox2.Text = "__:__" Then
  1237.         Call WritePrivateProfileString("When", "Each", MaskEdBox2.Text, Arq)
  1238.         Interval = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0)
  1239.     Else
  1240.         Call WritePrivateProfileString("When", "Each", "???", Arq)
  1241.         Interval = vbEmpty
  1242.     End If
  1243.     If OptionButton1 Then
  1244.         Call WritePrivateProfileString("When", "Default", False, Arq)
  1245.     Else
  1246.         Call WritePrivateProfileString("When", "Default", True, Arq)
  1247.     End If
  1248.     If OptionButton3 Then
  1249.         Call WritePrivateProfileString("When", "Days", "0", Arq)
  1250.     Else
  1251.         Days = 0
  1252.         Dim n As Byte
  1253.         For n = 0 To 6
  1254.             If CheckBox2(n + 1) Then Days = Days + 2 ^ n
  1255.         Next n
  1256.         Call WritePrivateProfileString("When", "Days", Days, Arq)
  1257.     End If
  1258.             
  1259.     If CheckBox1 Then
  1260.         Call WritePrivateProfileString("Log", "Save", "True", Arq)
  1261.     Else
  1262.         Call WritePrivateProfileString("Log", "Save", "False", Arq)
  1263.     End If
  1264.             
  1265.     If CheckBox4 Then
  1266.         Call WritePrivateProfileString("Backup", "Incremental", "True", Arq)
  1267.     Else
  1268.         Call WritePrivateProfileString("Backup", "Incremental", "False", Arq)
  1269.     End If
  1270.             
  1271.     Call WritePrivateProfileString("Destiny", "Dir", Text1.Text, Arq)
  1272.     For NLoops = 0 To List1.ListCount - 1
  1273.         If WritePrivateProfileString("Entries", CStr(NLoops), List1.List(NLoops), Arq) = 0 Then
  1274.             MsgBox "INI file full." & vbLf & "Last saved entry: " & List1.List(NLoops - 1), vbCritical
  1275.             GoTo Sa
  1276.         End If
  1277.     Next NLoops
  1278.     Screen.MousePointer = vbDefault
  1279.     Me.WindowState = vbMinimized
  1280.     Exit Sub
  1281. erro:
  1282.     MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1283.     Resume Sa
  1284. End Sub
  1285. Private Function VerificaDup(Item As String) As Boolean
  1286.     For LoopDup = 0 To List1.ListCount - 1
  1287.         If List1.List(LoopDup) = Item Then
  1288.             VerificaDup = True
  1289.             Exit Function
  1290.         End If
  1291.     Next LoopDup
  1292.     VerificaDup = False
  1293. End Function
  1294. Private Function VerifyErrors() As Boolean
  1295.     If List1.ListCount = 0 Then
  1296.         MsgBox "You must specify at least one file or directory for the backup!", vbCritical
  1297.         SSTab1.Tab = 1
  1298.         GoTo erro
  1299.     End If
  1300.     If Len(Text1.Text) = 0 Then
  1301.         MsgBox "You must specify the destiny dir.", vbCritical
  1302.         SSTab1.Tab = 2
  1303.         Text1.SetFocus
  1304.         GoTo erro
  1305.     ElseIf Text1.Text = "c:\" Or Text1.Text = "C:\" Then
  1306.         If MsgBox("The destiny dir was left as C:\." & vbLf & vbLf & "Confirm?", _
  1307.             vbYesNo + vbExclamation) = vbNo Then
  1308.             SSTab1.Tab = 2
  1309.             Text1.SetFocus
  1310.             GoTo erro
  1311.         End If
  1312.     ElseIf OptionButton1 And MaskEdBox1.Text = "__:__" Then
  1313.         MsgBox "You must specify a time for the backup!", vbCritical
  1314.         SSTab1.Tab = 0
  1315.         MaskEdBox1.SetFocus
  1316.         GoTo erro
  1317.     ElseIf OptionButton2 And MaskEdBox2.Text = "__:__" Then
  1318.         MsgBox "You must specify an interval for the backup!", vbCritical
  1319.         SSTab1.Tab = 0
  1320.         MaskEdBox2.SetFocus
  1321.         GoTo erro
  1322.     End If
  1323.     VerifyErrors = False
  1324.     Exit Function
  1325. erro:
  1326.     VerifyErrors = True
  1327. End Function
  1328. Private Sub CheckBox2_Click(Index As Integer)
  1329.     OptionButton3.Value = False
  1330. End Sub
  1331. Private Sub Command1_Click()
  1332. On Error GoTo erro
  1333.     For NLoops = List1.ListCount - 1 To 0 Step -1
  1334.         If List1.Selected(NLoops) Then List1.RemoveItem (NLoops)
  1335.     Next NLoops
  1336.     Exit Sub
  1337. erro:
  1338.     If Err.Number = 68 Then
  1339.         MsgBox "The selected drive is not available.", vbCritical
  1340.     Else
  1341.         MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1342.     End If
  1343.     Resume Sa
  1344. End Sub
  1345. Private Sub Command2_Click()
  1346.     Unload Me
  1347. End Sub
  1348. Private Sub Command3_Click()
  1349.     If Not VerifyErrors Then SaveChanges
  1350. End Sub
  1351. Private Sub Command4_Click()
  1352.     If CheckBox3.Value = True Then
  1353.         Call AddItem(False, True)
  1354.     Else
  1355.         Call AddItem(False)
  1356.     End If
  1357. End Sub
  1358. Private Sub Command5_Click()
  1359.     AddItem (True)
  1360. End Sub
  1361. Private Sub Command6_Click()
  1362.     If MsgBox("This will effectuate the backup now!" & vbLf & vbLf & _
  1363.         "Confirm?", vbQuestion + vbYesNo) = vbYes Then Backup
  1364.                 
  1365. End Sub
  1366. Private Sub Command7_Click()
  1367.     ShellExecute hwnd, "open", WindowsDir & "Log Autobak.txt", vbNullString, vbNullString, SW_SHOW
  1368. End Sub
  1369. Private Sub Dir2_Change()
  1370.     Text1.Text = Dir2.Path
  1371.     DestinyDir = Text1.Text
  1372. End Sub
  1373. Private Sub Drive1_Change()
  1374. On Error GoTo erro
  1375.     Dir1.Path = Drive1.Drive
  1376.         
  1377.     Exit Sub
  1378. erro:
  1379.     If Err.Number = 68 Then
  1380.         MsgBox "The selected drive is not available.", vbCritical
  1381.         Drive1.Drive = "c:"
  1382.     Else
  1383.         MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1384.     End If
  1385.     Resume Sa
  1386. End Sub
  1387. Private Sub Dir1_Change()
  1388.     File1.Path = Dir1.Path
  1389. End Sub
  1390. Private Sub Drive2_Change()
  1391. On Error GoTo erro
  1392.     Dir2.Path = Drive2.Drive
  1393.     Exit Sub
  1394. erro:
  1395.     If Err.Number = 68 Then
  1396.         MsgBox "The selected drive is not available.", vbCritical
  1397.         Drive2.Drive = "c:"
  1398.     Else
  1399.         MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1400.     End If
  1401.     Resume Sa
  1402. End Sub
  1403. Private Sub File1_DblClick()
  1404.     AddItem (True)
  1405.         
  1406. End Sub
  1407. Private Sub Form_Activate()
  1408.     If Not Default Then
  1409.         MaskEdBox1.SetFocus
  1410.     Else
  1411.         MaskEdBox2.SetFocus
  1412.     End If
  1413.     DoEvents
  1414.     If Not NoIniArchive Then Me.WindowState = vbMinimized
  1415. End Sub
  1416. Private Sub Form_Initialize()
  1417.     If App.PrevInstance Then
  1418.         MsgBox "There is another copy of the application being executed!", vbCritical
  1419.         OpenError = True
  1420.         Unload Me
  1421.         Set Form1 = Nothing
  1422.         End
  1423.     End If
  1424.         
  1425. End Sub
  1426. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  1427.     If ListWithFocus Then If KeyCode = 46 Then Command1_Click
  1428.         
  1429. End Sub
  1430. Private Sub Form_KeyPress(KeyAscii As Integer)
  1431.     If KeyAscii = 13 Then
  1432.         SendKeys "{TAB}"
  1433.         KeyAscii = 0
  1434.     End If
  1435. End Sub
  1436. Private Sub Form_Load()
  1437.     Dir1.Path = "C:\"
  1438.     Dir2.Path = "C:\"
  1439.     Initialize
  1440.     With nid
  1441.         .cbSize = Len(nid)
  1442.         .hwnd = Me.hwnd
  1443.         .uId = vbNull
  1444.         .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
  1445.         .uCallBackMessage = WM_MOUSEMOVE
  1446.         .hIcon = Me.Icon
  1447.         .szTip = "Auto Backup" & vbNullChar
  1448.     End With
  1449.     Shell_NotifyIcon NIM_ADD, nid
  1450.         
  1451. End Sub
  1452. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1453.     If Me.ScaleMode = vbPixels Then
  1454.         Msg = X
  1455.     Else
  1456.         Msg = X / Screen.TwipsPerPixelX
  1457.     End If
  1458.     Select Case Msg
  1459.         Case WM_LBUTTONUP '514 restore form window
  1460.         Me.WindowState = vbNormal
  1461.         Result = SetForegroundWindow(Me.hwnd)
  1462.         Me.Show
  1463.         Case WM_LBUTTONDBLCLK '515 restore form window
  1464.         Me.WindowState = vbNormal
  1465.         Result = SetForegroundWindow(Me.hwnd)
  1466.         Me.Show
  1467.         Case WM_RBUTTONUP '517 display popup menu
  1468.         Result = SetForegroundWindow(Me.hwnd)
  1469.         Me.PopupMenu Me.mnu_1
  1470.     End Select
  1471. End Sub
  1472. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  1473.     If OpenError Then Exit Sub
  1474.     If MsgBox("This will end the application." & vbLf & vbLf & "Are you sure?", vbQuestion + vbYesNo) = vbYes Then
  1475.         Unload Me
  1476.         Shell_NotifyIcon NIM_DELETE, nid
  1477.         Set Form1 = Nothing
  1478.         End
  1479.     Else
  1480.         Cancel = True
  1481.     End If
  1482. End Sub
  1483. Private Sub Form_Resize()
  1484.     If Me.WindowState = vbMinimized Then Me.Hide
  1485. End Sub
  1486. Private Sub Label16_Click()
  1487.     ShellExecute hwnd, "open", "mailto:alb@cwb.matrix.com.br", vbNullString, vbNullString, SW_SHOW
  1488. End Sub
  1489. Private Sub List1_GotFocus()
  1490.     ListWithFocus = True
  1491. End Sub
  1492. Private Sub List1_LostFocus()
  1493.     ListWithFocus = False
  1494. End Sub
  1495. Private Sub MaskEdBox1_GotFocus()
  1496.     FieldFocus
  1497.     MskErr1 = False
  1498.     OptionButton1.Value = True
  1499. End Sub
  1500. Private Sub MaskEdBox1_LostFocus()
  1501. On Error GoTo erro
  1502.     If MskErr2 Or MaskEdBox1.Text = "__:__" Then Exit Sub
  1503.     IniTime = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0)
  1504.             
  1505.     Exit Sub
  1506. erro:
  1507.     If Err.Number = 13 Then
  1508.         MsgBox "Invalid time.", vbCritical
  1509.     Else
  1510.         MsgBox Err.Number & vbLf & Err.Description
  1511.     End If
  1512.     MskErr1 = True
  1513.     MaskEdBox1.SetFocus
  1514.     IniTime = vbEmpty
  1515.     Resume Sa
  1516. End Sub
  1517. Private Sub MaskEdBox2_GotFocus()
  1518.     OptionButton2.Value = True
  1519.     FieldFocus
  1520.     MskErr2 = False
  1521. End Sub
  1522. Sub FieldFocus()
  1523.     Screen.ActiveForm.ActiveControl.SelStart = 0
  1524.     Screen.ActiveForm.ActiveControl.SelLength = Len(Screen.ActiveForm.ActiveControl.Text)
  1525. End Sub
  1526. Private Sub MaskEdBox2_LostFocus()
  1527. On Error GoTo erro
  1528.     If MskErr1 Then Exit Sub
  1529.     If MaskEdBox2.Text = "__:__" Then
  1530.         OptionButton1.Value = True
  1531.         IniTime = "00:00"
  1532.         GoTo Sa
  1533.     End If
  1534.     Interval = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0)
  1535.     Exit Sub
  1536. erro:
  1537.     If Err.Number = 13 Then
  1538.         MsgBox "Invalid interval.", vbCritical
  1539.     Else
  1540.         MsgBox Err.Number & vbLf & Err.Description
  1541.     End If
  1542.     MskErr2 = True
  1543.     Interval = vbEmpty
  1544.     MaskEdBox2.SetFocus
  1545.     Resume Sa
  1546. End Sub
  1547. Private Sub MnuBackup_Click()
  1548.     Command6_Click
  1549. End Sub
  1550. Private Sub MnuRestaurar_Click()
  1551.     Me.WindowState = vbNormal
  1552.     Result = SetForegroundWindow(Me.hwnd)
  1553.     Me.Show
  1554. End Sub
  1555. Private Sub MnuSair_Click()
  1556.     Unload Me
  1557. End Sub
  1558. Private Sub MnuQuit_Click()
  1559.     Unload Me
  1560. End Sub
  1561. Private Sub MnuRestore_Click()
  1562.     Me.WindowState = vbNormal
  1563.     Result = SetForegroundWindow(Me.hwnd)
  1564.     Me.Show
  1565. End Sub
  1566. Private Sub OptionButton1_Click()
  1567.     MaskEdBox1.SetFocus
  1568. End Sub
  1569. Private Sub OptionButton2_Click()
  1570.     MaskEdBox2.SetFocus
  1571. End Sub
  1572. Private Sub OptionButton3_Click()
  1573.     For NLoops = 1 To 7
  1574.         CheckBox2(NLoops).Value = False
  1575.     Next NLoops
  1576.     OptionButton3.Value = True
  1577. End Sub
  1578. Private Sub Text1_GotFocus()
  1579.     FieldFocus
  1580. End Sub
  1581. Private Sub Timer1_Timer()
  1582.     If Interval = vbEmpty And IniTime = vbEmpty Then Exit Sub
  1583.         
  1584.     If Not OptionButton3 Then
  1585.         For NLoopsTimer = 1 To 7
  1586.             If CheckBox2(NLoopsTimer).Value = True Then If Format(Date, "w") = NLoopsTimer Then CheckTime
  1587.         Next NLoopsTimer
  1588.     Else
  1589.         CheckTime
  1590.     End If
  1591.         
  1592. End Sub
  1593.